package cn.wsn2018.tools.ctrl;

import cn.wsn2018.tools.common.CommonValue;
import cn.wsn2018.tools.service.RecommendService;
import cn.wsn2018.tools.util.ServletUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
public class RecommendController {
    @Resource
    private RecommendService recommendService;
    @RequestMapping(CommonValue.REQUEST_MAPPING_LISTRECOMMENDS)
    /**
     * 根据协议名罗列安全建议
     */
    public void listRecommends(HttpServletRequest request, HttpServletResponse response)throws Exception{
        ServletUtil.getInstance().requestOperating(request);
        String protocolName=request.getParameter(CommonValue.REQUEST_PARAM_PROTOCOLNAME);
        String json=recommendService.dealListRecommends(protocolName);
        ServletUtil.getInstance().responseOperating(response, json);
    }
}
